From 4402b53e98c4c85256f08b3c846901be77dacbc9 Mon Sep 17 00:00:00 2001 From: robertl Date: Sun, 11 Oct 2009 20:48:34 +0000 Subject: [PATCH] Add teletype format. --- Makefile.in | 3 +- reference/track/teletype.gpx | 556 +++++++++++++++++++++++++++++++++++ reference/track/teletype.way | Bin 0 -> 6311 bytes teletype.c | 139 +++++++++ testo | 8 + vecs.c | 7 + xmldoc/formats/teletype.xml | 7 + 7 files changed, 719 insertions(+), 1 deletion(-) create mode 100644 reference/track/teletype.gpx create mode 100644 reference/track/teletype.way create mode 100644 teletype.c create mode 100644 xmldoc/formats/teletype.xml diff --git a/Makefile.in b/Makefile.in index ac24c91aa..97bd8ddf2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -63,7 +63,8 @@ ALL_FMTS=$(MINIMAL_FMTS) gtm.o gpsutil.o pcx.o cetus.o copilot.o \ navilink.o mtk_logger.o ik3d.o osm.o destinator.o exif.o vidaone.o \ igo8.o gopal.o humminbird.o mapasia.o gnav_trl.o navitel.o ggv_ovl.o \ jtr.o sbp.o sbn.o mmo.o skyforce.o itracku.o v900.o delbin.o \ - pocketfms_bc.o pocketfms_fp.o pocketfms_wp.o naviguide.o enigma.o vpl.o \ + pocketfms_bc.o pocketfms_fp.o pocketfms_wp.o naviguide.o enigma.o \ + vpl.o teletype.o \ FMTS=@FMTS@ diff --git a/reference/track/teletype.gpx b/reference/track/teletype.gpx new file mode 100644 index 000000000..5348d4d79 --- /dev/null +++ b/reference/track/teletype.gpx @@ -0,0 +1,556 @@ + + + + + + 19 Cadman Plz + 19 Cadman Plz\Old Fulton St, brooklyn, NY 11201, United States + 19 Cadman Plz\Old Fulton St, brooklyn, NY 11201, United States + + + 349 E 12th St, new york, NY 10003, United States + 349 E 12th St, new york, NY 10003, United States + 349 E 12th St, new york, NY 10003, United States + + + Pizza Town + NE[10.20 mi] - Pizza Town, 1827 College Point Blvd, Flushing, NY 11356 (718-9392187) + NE[10.20 mi] - Pizza Town, 1827 College Point Blvd, Flushing, NY 11356 (718-9392187) + + + New Pizza Town Ii + NE[9.34 mi] - New Pizza Town Ii, 360 7th Ave, New York, NY 10001 (212-6959229) + NE[9.34 mi] - New Pizza Town Ii, 360 7th Ave, New York, NY 10001 (212-6959229) + + + 371 7th Ave + 371 7th Ave\Penn Plz\Fashion Ave, new york, NY 10001, United States + 371 7th Ave\Penn Plz\Fashion Ave, new york, NY 10001, United States + + + WP #1 + WP #1 + WP #1 + + + 371 7th Ave + 371 7th Ave\Penn Plz\Fashion Ave, new york, NY 10001, United States + 371 7th Ave\Penn Plz\Fashion Ave, new york, NY 10001, United States + + + St Patrick's Cathedral + NE[1.30 mi] - St Patrick's Cathedral, 460 Madison Ave, New York, NY 10022 (212-7532261) + NE[1.30 mi] - St Patrick's Cathedral, 460 Madison Ave, New York, NY 10022 (212-7532261) + + + St Patrick's Cathedral + 460 Madison Ave, New York, NY 10022, 212-7532261 + 460 Madison Ave, New York, NY 10022, 212-7532261 + + + WP #1 + ALT=1627 ft +UTC=22:27:46 +Speed:584 mph + ALT=1627 ft +UTC=22:27:46 +Speed:584 mph + + + WP #2 + ALT=29993 ft +UTC=22:28:47 +Speed:580 mph + ALT=29993 ft +UTC=22:28:47 +Speed:580 mph + + + WP #3 + ALT=30003 ft +UTC=22:29:48 +Speed:609 mph + ALT=30003 ft +UTC=22:29:48 +Speed:609 mph + + + WP #4 + ALT=30009 ft +UTC=22:30:48 +Speed:611 mph + ALT=30009 ft +UTC=22:30:48 +Speed:611 mph + + + WP #5 + ALT=30016 ft +UTC=22:31:47 +Speed:605 mph + ALT=30016 ft +UTC=22:31:47 +Speed:605 mph + + + WP #6 + ALT=30039 ft +UTC=22:32:47 +Speed:586 mph + ALT=30039 ft +UTC=22:32:47 +Speed:586 mph + + + WP #7 + ALT=30039 ft +UTC=22:34:47 +Speed:600 mph + ALT=30039 ft +UTC=22:34:47 +Speed:600 mph + + + WP #8 + ALT=30039 ft +UTC=22:37:13 +Speed:610 mph + ALT=30039 ft +UTC=22:37:13 +Speed:610 mph + + + WP #9 + ALT=30039 ft +UTC=22:37:17 +Speed:611 mph + ALT=30039 ft +UTC=22:37:17 +Speed:611 mph + + + WP #10 + ALT=30039 ft +UTC=22:37:20 +Speed:611 mph + ALT=30039 ft +UTC=22:37:20 +Speed:611 mph + + + WP #11 + ALT=30039 ft +UTC=22:37:21 +Speed:611 mph + ALT=30039 ft +UTC=22:37:21 +Speed:611 mph + + + WP #12 + ALT=30039 ft +UTC=22:37:24 +Speed:612 mph + ALT=30039 ft +UTC=22:37:24 +Speed:612 mph + + + WP #13 + ALT=30039 ft +UTC=22:37:25 +Speed:612 mph + ALT=30039 ft +UTC=22:37:25 +Speed:612 mph + + + WP #14 + ALT=30039 ft +UTC=22:37:28 +Speed:612 mph + ALT=30039 ft +UTC=22:37:28 +Speed:612 mph + + + WP #15 + ALT=30039 ft +UTC=22:37:29 +Speed:612 mph + ALT=30039 ft +UTC=22:37:29 +Speed:612 mph + + + WP #16 + ALT=30039 ft +UTC=22:37:32 +Speed:612 mph + ALT=30039 ft +UTC=22:37:32 +Speed:612 mph + + + WP #17 + ALT=30039 ft +UTC=22:37:35 +Speed:612 mph + ALT=30039 ft +UTC=22:37:35 +Speed:612 mph + + + WP #18 + ALT=30039 ft +UTC=22:38:37 +Speed:611 mph + ALT=30039 ft +UTC=22:38:37 +Speed:611 mph + + + WP #19 + ALT=30039 ft +UTC=22:38:47 +Speed:611 mph + ALT=30039 ft +UTC=22:38:47 +Speed:611 mph + + + WP #20 + ALT=30039 ft +UTC=22:39:49 +Speed:613 mph + ALT=30039 ft +UTC=22:39:49 +Speed:613 mph + + + WP #21 + ALT=30111 ft +UTC=22:40:49 +Speed:615 mph + ALT=30111 ft +UTC=22:40:49 +Speed:615 mph + + + WP #22 + ALT=30131 ft +UTC=22:41:48 +Speed:613 mph + ALT=30131 ft +UTC=22:41:48 +Speed:613 mph + + + WP #23 + ALT=30147 ft +UTC=22:42:49 +Speed:612 mph + ALT=30147 ft +UTC=22:42:49 +Speed:612 mph + + + WP #24 + ALT=30124 ft +UTC=22:46:48 +Speed:630 mph + ALT=30124 ft +UTC=22:46:48 +Speed:630 mph + + + WP #25 + ALT=30141 ft +UTC=22:47:22 +Speed:638 mph + ALT=30141 ft +UTC=22:47:22 +Speed:638 mph + + + WP #26 + ALT=30150 ft +UTC=22:48:23 +Speed:676 mph + ALT=30150 ft +UTC=22:48:23 +Speed:676 mph + + + WP #27 + ALT=30121 ft +UTC=22:49:23 +Speed:695 mph + ALT=30121 ft +UTC=22:49:23 +Speed:695 mph + + + WP #28 + ALT=30144 ft +UTC=22:50:23 +Speed:696 mph + ALT=30144 ft +UTC=22:50:23 +Speed:696 mph + + + WP #29 + ALT=30134 ft +UTC=22:51:23 +Speed:697 mph + ALT=30134 ft +UTC=22:51:23 +Speed:697 mph + + + WP #30 + ALT=30144 ft +UTC=22:52:23 +Speed:698 mph + ALT=30144 ft +UTC=22:52:23 +Speed:698 mph + + + WP #31 + ALT=30150 ft +UTC=22:53:24 +Speed:696 mph + ALT=30150 ft +UTC=22:53:24 +Speed:696 mph + + + WP #32 + ALT=30154 ft +UTC=22:54:23 +Speed:696 mph + ALT=30154 ft +UTC=22:54:23 +Speed:696 mph + + + WP #33 + ALT=30157 ft +UTC=22:55:24 +Speed:695 mph + ALT=30157 ft +UTC=22:55:24 +Speed:695 mph + + + WP #34 + ALT=30157 ft +UTC=22:55:52 +Speed:685 mph + ALT=30157 ft +UTC=22:55:52 +Speed:685 mph + + + WP #35 + ALT=30170 ft +UTC=22:56:58 +Speed:685 mph + ALT=30170 ft +UTC=22:56:58 +Speed:685 mph + + + WP #36 + ALT=30164 ft +UTC=22:57:55 +Speed:684 mph + ALT=30164 ft +UTC=22:57:55 +Speed:684 mph + + + WP #37 + ALT=30180 ft +UTC=22:58:55 +Speed:683 mph + ALT=30180 ft +UTC=22:58:55 +Speed:683 mph + + + WP #38 + ALT=30167 ft +UTC=22:59:56 +Speed:683 mph + ALT=30167 ft +UTC=22:59:56 +Speed:683 mph + + + WP #39 + ALT=30164 ft +UTC=23:00:57 +Speed:682 mph + ALT=30164 ft +UTC=23:00:57 +Speed:682 mph + + + WP #40 + ALT=30167 ft +UTC=23:01:57 +Speed:683 mph + ALT=30167 ft +UTC=23:01:57 +Speed:683 mph + + + WP #41 + ALT=30167 ft +UTC=23:02:57 +Speed:683 mph + ALT=30167 ft +UTC=23:02:57 +Speed:683 mph + + + WP #42 + ALT=30157 ft +UTC=23:03:57 +Speed:673 mph + ALT=30157 ft +UTC=23:03:57 +Speed:673 mph + + + WP #43 + ALT=29983 ft +UTC=23:04:55 +Speed:685 mph + ALT=29983 ft +UTC=23:04:55 +Speed:685 mph + + + WP #44 + ALT=29169 ft +UTC=23:05:58 +Speed:682 mph + ALT=29169 ft +UTC=23:05:58 +Speed:682 mph + + + WP #45 + ALT=28448 ft +UTC=23:06:58 +Speed:670 mph + ALT=28448 ft +UTC=23:06:58 +Speed:670 mph + + + WP #46 + ALT=25875 ft +UTC=23:07:57 +Speed:676 mph + ALT=25875 ft +UTC=23:07:57 +Speed:676 mph + + + WP #47 + ALT=18838 ft +UTC=23:09:48 +Speed:577 mph + ALT=18838 ft +UTC=23:09:48 +Speed:577 mph + + + WP #48 + ALT=15324 ft +UTC=23:11:52 +Speed:498 mph + ALT=15324 ft +UTC=23:11:52 +Speed:498 mph + + + WP #49 + ALT=13845 ft +UTC=23:12:53 +Speed:490 mph + ALT=13845 ft +UTC=23:12:53 +Speed:490 mph + + + WP #50 + ALT=12483 ft +UTC=23:13:52 +Speed:449 mph + ALT=12483 ft +UTC=23:13:52 +Speed:449 mph + + + WP #51 + ALT=12460 ft +UTC=23:14:52 +Speed:451 mph + ALT=12460 ft +UTC=23:14:52 +Speed:451 mph + + + WP #52 + ALT=9553 ft +UTC=23:18:52 +Speed:361 mph + ALT=9553 ft +UTC=23:18:52 +Speed:361 mph + + + WP #53 + ALT=9527 ft +UTC=23:19:54 +Speed:357 mph + ALT=9527 ft +UTC=23:19:54 +Speed:357 mph + + + WP #54 + ALT=9540 ft +UTC=23:20:52 +Speed:307 mph + ALT=9540 ft +UTC=23:20:52 +Speed:307 mph + + + 15 E 54th St, New york, NY, United States + 15 E 54th St, New york, NY, United States + 15 E 54th St, New york, NY, United States + + + 14 E 51st St, new york, NY, United States + 14 E 51st St, new york, NY, United States + 14 E 51st St, new york, NY, United States + + + 14 E 51st St, new york, NY, United States + 14 E 51st St, new york, NY, United States + 14 E 51st St, new york, NY, United States + + diff --git a/reference/track/teletype.way b/reference/track/teletype.way new file mode 100644 index 0000000000000000000000000000000000000000..8d44f3dacd1fa7386935856083797e26fa88f025 GIT binary patch literal 6311 zcmcJTe{5Cd8OM(Wr&Sp@W4dXU>(m@P;N$P>FnGty_fdN?QPTE z7O53*LLx_Q#f(6vxQ2jgZOya8AwUkg*?T3y6Jn-SfQf`SG56 z&LwQgPSSf%-}Bzj`<(CdeBbw+_e1yM?1g<(4eRuS?1kT#8Wg1=Gw*GMAFYi~PIkcG z_s@+q-k~%oJKh~>gbvE|$|on4w?E!~ZDxA%UihE5YD>N_n6Ie0@p2O^_5b!Sb)pC1$`k+G&t^U~h(jvM z+}s>AVKYCU(+yW`RSB&QaB!u#Mcq0yvRQyNP19?^|Md?H910E?vgzgn?5ErPNZ^JW zMYE!qaFQ!cOyt$hp)D1qqxF8GEvK3~So((Aq()b=DsiZ-whWca#r~q28!A<*>b>Rh zLRM`nkBttLD*e7Bx@oCPY~nPzx=V>;FIA55d**Rqmbz9~8n_I{XZV+YRZ%)Xf@nmw zy@cVo%XPz#CUHHh>XxS3py0~!A`B0|?~x@W>Jmz5ljWK&rS4MY9OS?k>lZbeWcLj^Zz-_mu|!$<6(-XH9Snbb_N>O zRn=U+I#TM}eAg%#r#et9jO5F_c9!cw>7;kcss?0iO}7!vlgTupjz!R?rq=u>rAEK`eD$ zSC4TW&#)sdNDbUAQMH^s^1twT+^{Q_i)7BwqYLo!9R8;^~F9IuU&_0NL))3dGoQDpg*3y zo_&4eV@WRdL9SDW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s(bpk ig@YXTVC=uv$^ZXj?5>-{=DzeE_@~?n4gUd2@Lz-g literal 0 HcmV?d00001 diff --git a/teletype.c b/teletype.c new file mode 100644 index 000000000..848215913 --- /dev/null +++ b/teletype.c @@ -0,0 +1,139 @@ +/* + + teletype .way module + + Copyright (C) 2009 Robert Lipe, robertlipe@gpsbabel.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA + + */ + +#include "defs.h" + +#define MYNAME "teletype" + + +static +arglist_t teletype_args[] = { + ARG_TERMINATOR +}; + +/******************************************************************************* +* %%% global callbacks called by gpsbabel main process %%% * +*******************************************************************************/ + +static gbuint32 tty_wpt_count; +static gbfile *fin; + +static void +teletype_rd_init(const char *fname) +{ + char header[64]; + + fin = gbfopen(fname, "r", MYNAME); + + gbfread(header, sizeof(header), 1, fin); + tty_wpt_count = gbfgetint32(fin); +} + +static void +teletype_rd_deinit(void) +{ + gbfclose(fin); +} + +static void +teletype_read(void) +{ + int i; + for (i = 0; i < tty_wpt_count; i++) { + waypoint *wpt = waypt_new(); + wpt->shortname = xstrdup(gbfgetcstr(fin)); + wpt->description = xstrdup(gbfgetcstr(fin)); + + if (1) { // needs bit values of NEWFORMAT2 + int direction = gbfgetuint32(fin); + int mins = gbfgetuint32(fin); + } + + if (1) { // need bit value of NEWFORMAT + int len = gbfgetuint16(fin); + // probably could treat as a pascal string + char *junk = xmalloc(len); + gbfread(junk, len, 1, fin); + } + wpt->latitude = gbfgetint32(fin) / 1000000.0 ; + wpt->longitude = gbfgetint32(fin) / 1000000.0 ; + + { + char jibberish[21]; + gbfread(jibberish, sizeof(jibberish), 1, fin); + } + + + waypt_add(wpt); + } +} + +static void +teletype_wr_init(const char *fname) +{ +// fout = gbfopen(fname, "w", MYNAME); +} + +static void +teletype_wr_deinit(void) +{ +// gbfclose(fout); +} + +static void +teletype_write(void) +{ +// Here is how you register callbacks for all waypoints, routes, tracks. +// waypt_disp_all(waypt) +// route_disp_all(head, tail, rtept); +// track_disp_all(head, tail, trkpt); +} + +static void +teletype_exit(void) /* optional */ +{ +} + +/**************************************************************************/ + +// capabilities below means: we can only read and write waypoints +// please change this depending on your new module + +ff_vecs_t teletype_vecs = { + ff_type_file, + { + ff_cap_read | ff_cap_write /* waypoints */, + ff_cap_none /* tracks */, + ff_cap_none /* routes */ + }, + teletype_rd_init, + teletype_wr_init, + teletype_rd_deinit, + teletype_wr_deinit, + teletype_read, + teletype_write, + teletype_exit, + teletype_args, + CET_CHARSET_ASCII, 0 /* ascii is the expected character set */ + /* not fixed, can be changed through command line parameter */ +}; +/**************************************************************************/ diff --git a/testo b/testo index 1ba38da0a..241143a90 100755 --- a/testo +++ b/testo @@ -1639,4 +1639,12 @@ rm -f ${TMPDIR}/skytraq.* gpsbabel -t -w -i skytraq-bin -f ${REFERENCE}/skytraq.bin -o gpx -F ${TMPDIR}/skytraq.gpx compare ${TMPDIR}/skytraq.gpx ${REFERENCE}/skytraq.gpx +# +# Skytraq logger tests +# +rm -f ${TMPDIR}/teletype.* +gpsbabel -i teletype -f ${REFERENCE}/track/teletype.way -o gpx -F ${TMPDIR}/teletype.gpx +compare ${TMPDIR}/teletype.gpx ${REFERENCE}/track/teletype.gpx + +exit 0 exit 0 diff --git a/vecs.c b/vecs.c index 8fda5462f..45497f11f 100644 --- a/vecs.c +++ b/vecs.c @@ -166,6 +166,7 @@ extern ff_vecs_t pocketfms_fp_vecs; extern ff_vecs_t pocketfms_wp_vecs; extern ff_vecs_t enigma_vecs; extern ff_vecs_t vpl_vecs; +extern ff_vecs_t teletype_vecs; static vecs_t vec_list[] = { @@ -964,6 +965,12 @@ vecs_t vec_list[] = { "SkyTraq Venus based loggers (download)", NULL }, + { + &teletype_vecs, + "teletype", + "Teletype [ Get Jonathon Johnson to describe", + NULL + }, { &skytraq_fvecs, "skytraq-bin", diff --git a/xmldoc/formats/teletype.xml b/xmldoc/formats/teletype.xml new file mode 100644 index 000000000..3d23e8fed --- /dev/null +++ b/xmldoc/formats/teletype.xml @@ -0,0 +1,7 @@ + +This format reads the files written by the Teletype GPS devices with the extension of ".way". + + + It's not entirely clear exactly which Teletype products are supported or + what versions write the format we read. + -- 2.30.2